#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<string.h>


int jump(int* nums, int numsSize)
{
    if (numsSize == 1 || numsSize == 0)
    {
        return 0;
    }
    int count = 1;
    int i = 1;
    int tempsize = nums[0];
    int size = nums[0];
    while (size < numsSize - 1) 
    {
        if (size < nums[i] + i) 
        {
            size = nums[i] + i;
            if (size >= numsSize - 1)
            {
                count++;
                return count;
            }
        }
        if (i == tempsize)
        {
            tempsize = size;
            count++;
        }
        i++;
    }
    return count;
}

int main()
{
    int nums[10]={1,3,2,2,4};
    printf("%d\n", jump(nums, 5));
    return 0;
}